/*
 * FfMediaInfo.h
 *
 *  Created on: 2023年7月5日
 *      Author: terry
 */

#ifndef INCLUDE_FFMEDIAINFO_H_
#define INCLUDE_FFMEDIAINFO_H_


///////////////////////////////////////////////////////////////////
#ifdef WIN32

    #ifndef NOMINMAX
    #define NOMINMAX
    #endif //NOMINMAX

    //#pragma warning( disable : 4786 )
    #include <winsock2.h>
    //#include <windows.h>

#else


#endif //WIN32


///////////////////////////////////////////////////////////////////
#include <stddef.h>
#include <string.h>
///////////////////////////////////////////////////////////////////

#ifndef SOCKET_T
    #ifdef WIN32
        typedef SOCKET  socket_t;
    #else
        typedef int     socket_t;
    #endif // WIN32

    #define SOCKET_T

#endif //SOCKET_T



#ifdef _MSC_VER
#if (_MSC_VER >= 1700)
    #include <stdint.h>
#else
    typedef signed char     int8_t;
    typedef unsigned char   uint8_t;
    typedef short           int16_t;
    typedef unsigned short  uint16_t;
    typedef int             int32_t;
    typedef unsigned        uint32_t;
    typedef long long       int64_t;
    typedef unsigned long long   uint64_t;
#endif

#else
    #include <stdint.h>
#endif //_MSC_VER


///////////////////////////////////////////////////////////////////
#ifdef WIN32
    #ifndef DLLEXPORT
    #define DLLEXPORT __declspec(dllexport)
    #endif //DLLEXPORT
#else
    #ifndef DLLEXPORT
    #define DLLEXPORT __attribute__ ((visibility ("default")))
    #endif //DLLEXPORT
#endif //WIN32

///////////////////////////////////////////////////////////////////

#ifdef WIN32
#else
    typedef void*   HANDLE;
    typedef int     BOOL;
    typedef void*	HWND;
    typedef void*	HDC;

	#define WINAPI

#endif //


/////////////////////////////////////////////////////////////////////////////
#ifdef __cplusplus
extern "C"
{
#endif

/////////////////////////////////////////////////////////////////////////////

#ifndef MKTAG
#define MKTAG(a,b,c,d) ((a) | ((b) << 8) | ((c) << 16) | ((unsigned)(d) << 24))
#endif //MKTAG


enum FfMediaCodec
{
    FFMEDIA_CODEC_NONE = 0,

    /* video codecs */
    FFMEDIA_CODEC_MPEG1VIDEO,
    FFMEDIA_CODEC_MPEG2VIDEO, ///< preferred ID for MPEG-1/2 video decoding
    FFMEDIA_CODEC_H261,
    FFMEDIA_CODEC_H263,
    FFMEDIA_CODEC_RV10,
    FFMEDIA_CODEC_RV20,
    FFMEDIA_CODEC_MJPEG,
    FFMEDIA_CODEC_MJPEGB,
    FFMEDIA_CODEC_LJPEG,
    FFMEDIA_CODEC_SP5X,
    FFMEDIA_CODEC_JPEGLS,
    FFMEDIA_CODEC_MPEG4,
    FFMEDIA_CODEC_RAWVIDEO,
    FFMEDIA_CODEC_MSMPEG4V1,
    FFMEDIA_CODEC_MSMPEG4V2,
    FFMEDIA_CODEC_MSMPEG4V3,
    FFMEDIA_CODEC_WMV1,
    FFMEDIA_CODEC_WMV2,
    FFMEDIA_CODEC_H263P,
    FFMEDIA_CODEC_H263I,
    FFMEDIA_CODEC_FLV1,
    FFMEDIA_CODEC_SVQ1,
    FFMEDIA_CODEC_SVQ3,
    FFMEDIA_CODEC_DVVIDEO,
    FFMEDIA_CODEC_HUFFYUV,
    FFMEDIA_CODEC_CYUV,
    FFMEDIA_CODEC_H264,
    FFMEDIA_CODEC_INDEO3,
    FFMEDIA_CODEC_VP3,
    FFMEDIA_CODEC_THEORA,
    FFMEDIA_CODEC_ASV1,
    FFMEDIA_CODEC_ASV2,
    FFMEDIA_CODEC_FFV1,
    FFMEDIA_CODEC_4XM,
    FFMEDIA_CODEC_VCR1,
    FFMEDIA_CODEC_CLJR,
    FFMEDIA_CODEC_MDEC,
    FFMEDIA_CODEC_ROQ,
    FFMEDIA_CODEC_INTERPLAY_VIDEO,
    FFMEDIA_CODEC_XAN_WC3,
    FFMEDIA_CODEC_XAN_WC4,
    FFMEDIA_CODEC_RPZA,
    FFMEDIA_CODEC_CINEPAK,
    FFMEDIA_CODEC_WS_VQA,
    FFMEDIA_CODEC_MSRLE,
    FFMEDIA_CODEC_MSVIDEO1,
    FFMEDIA_CODEC_IDCIN,
    FFMEDIA_CODEC_8BPS,
    FFMEDIA_CODEC_SMC,
    FFMEDIA_CODEC_FLIC,
    FFMEDIA_CODEC_TRUEMOTION1,
    FFMEDIA_CODEC_VMDVIDEO,
    FFMEDIA_CODEC_MSZH,
    FFMEDIA_CODEC_ZLIB,
    FFMEDIA_CODEC_QTRLE,
    FFMEDIA_CODEC_TSCC,
    FFMEDIA_CODEC_ULTI,
    FFMEDIA_CODEC_QDRAW,
    FFMEDIA_CODEC_VIXL,
    FFMEDIA_CODEC_QPEG,
    FFMEDIA_CODEC_PNG,
    FFMEDIA_CODEC_PPM,
    FFMEDIA_CODEC_PBM,
    FFMEDIA_CODEC_PGM,
    FFMEDIA_CODEC_PGMYUV,
    FFMEDIA_CODEC_PAM,
    FFMEDIA_CODEC_FFVHUFF,
    FFMEDIA_CODEC_RV30,
    FFMEDIA_CODEC_RV40,
    FFMEDIA_CODEC_VC1,
    FFMEDIA_CODEC_WMV3,
    FFMEDIA_CODEC_LOCO,
    FFMEDIA_CODEC_WNV1,
    FFMEDIA_CODEC_AASC,
    FFMEDIA_CODEC_INDEO2,
    FFMEDIA_CODEC_FRAPS,
    FFMEDIA_CODEC_TRUEMOTION2,
    FFMEDIA_CODEC_BMP,
    FFMEDIA_CODEC_CSCD,
    FFMEDIA_CODEC_MMVIDEO,
    FFMEDIA_CODEC_ZMBV,
    FFMEDIA_CODEC_AVS,
    FFMEDIA_CODEC_SMACKVIDEO,
    FFMEDIA_CODEC_NUV,
    FFMEDIA_CODEC_KMVC,
    FFMEDIA_CODEC_FLASHSV,
    FFMEDIA_CODEC_CAVS,
    FFMEDIA_CODEC_JPEG2000,
    FFMEDIA_CODEC_VMNC,
    FFMEDIA_CODEC_VP5,
    FFMEDIA_CODEC_VP6,
    FFMEDIA_CODEC_VP6F,
    FFMEDIA_CODEC_TARGA,
    FFMEDIA_CODEC_DSICINVIDEO,
    FFMEDIA_CODEC_TIERTEXSEQVIDEO,
    FFMEDIA_CODEC_TIFF,
    FFMEDIA_CODEC_GIF,
    FFMEDIA_CODEC_DXA,
    FFMEDIA_CODEC_DNXHD,
    FFMEDIA_CODEC_THP,
    FFMEDIA_CODEC_SGI,
    FFMEDIA_CODEC_C93,
    FFMEDIA_CODEC_BETHSOFTVID,
    FFMEDIA_CODEC_PTX,
    FFMEDIA_CODEC_TXD,
    FFMEDIA_CODEC_VP6A,
    FFMEDIA_CODEC_AMV,
    FFMEDIA_CODEC_VB,
    FFMEDIA_CODEC_PCX,
    FFMEDIA_CODEC_SUNRAST,
    FFMEDIA_CODEC_INDEO4,
    FFMEDIA_CODEC_INDEO5,
    FFMEDIA_CODEC_MIMIC,
    FFMEDIA_CODEC_RL2,
    FFMEDIA_CODEC_ESCAPE124,
    FFMEDIA_CODEC_DIRAC,
    FFMEDIA_CODEC_BFI,
    FFMEDIA_CODEC_CMV,
    FFMEDIA_CODEC_MOTIONPIXELS,
    FFMEDIA_CODEC_TGV,
    FFMEDIA_CODEC_TGQ,
    FFMEDIA_CODEC_TQI,
    FFMEDIA_CODEC_AURA,
    FFMEDIA_CODEC_AURA2,
    FFMEDIA_CODEC_V210X,
    FFMEDIA_CODEC_TMV,
    FFMEDIA_CODEC_V210,
    FFMEDIA_CODEC_DPX,
    FFMEDIA_CODEC_MAD,
    FFMEDIA_CODEC_FRWU,
    FFMEDIA_CODEC_FLASHSV2,
    FFMEDIA_CODEC_CDGRAPHICS,
    FFMEDIA_CODEC_R210,
    FFMEDIA_CODEC_ANM,
    FFMEDIA_CODEC_BINKVIDEO,
    FFMEDIA_CODEC_IFF_ILBM,
#define FFMEDIA_CODEC_IFF_BYTERUN1 FFMEDIA_CODEC_IFF_ILBM
    FFMEDIA_CODEC_KGV1,
    FFMEDIA_CODEC_YOP,
    FFMEDIA_CODEC_VP8,
    FFMEDIA_CODEC_PICTOR,
    FFMEDIA_CODEC_ANSI,
    FFMEDIA_CODEC_A64_MULTI,
    FFMEDIA_CODEC_A64_MULTI5,
    FFMEDIA_CODEC_R10K,
    FFMEDIA_CODEC_MXPEG,
    FFMEDIA_CODEC_LAGARITH,
    FFMEDIA_CODEC_PRORES,
    FFMEDIA_CODEC_JV,
    FFMEDIA_CODEC_DFA,
    FFMEDIA_CODEC_WMV3IMAGE,
    FFMEDIA_CODEC_VC1IMAGE,
    FFMEDIA_CODEC_UTVIDEO,
    FFMEDIA_CODEC_BMV_VIDEO,
    FFMEDIA_CODEC_VBLE,
    FFMEDIA_CODEC_DXTORY,
    FFMEDIA_CODEC_V410,
    FFMEDIA_CODEC_XWD,
    FFMEDIA_CODEC_CDXL,
    FFMEDIA_CODEC_XBM,
    FFMEDIA_CODEC_ZEROCODEC,
    FFMEDIA_CODEC_MSS1,
    FFMEDIA_CODEC_MSA1,
    FFMEDIA_CODEC_TSCC2,
    FFMEDIA_CODEC_MTS2,
    FFMEDIA_CODEC_CLLC,
    FFMEDIA_CODEC_MSS2,
    FFMEDIA_CODEC_VP9,
    FFMEDIA_CODEC_AIC,
    FFMEDIA_CODEC_ESCAPE130,
    FFMEDIA_CODEC_G2M,
    FFMEDIA_CODEC_WEBP,
    FFMEDIA_CODEC_HNM4_VIDEO,
    FFMEDIA_CODEC_HEVC,
#define FFMEDIA_CODEC_H265 FFMEDIA_CODEC_HEVC
    FFMEDIA_CODEC_FIC,
    FFMEDIA_CODEC_ALIAS_PIX,
    FFMEDIA_CODEC_BRENDER_PIX,
    FFMEDIA_CODEC_PAF_VIDEO,
    FFMEDIA_CODEC_EXR,
    FFMEDIA_CODEC_VP7,
    FFMEDIA_CODEC_SANM,
    FFMEDIA_CODEC_SGIRLE,
    FFMEDIA_CODEC_MVC1,
    FFMEDIA_CODEC_MVC2,
    FFMEDIA_CODEC_HQX,
    FFMEDIA_CODEC_TDSC,
    FFMEDIA_CODEC_HQ_HQA,
    FFMEDIA_CODEC_HAP,
    FFMEDIA_CODEC_DDS,
    FFMEDIA_CODEC_DXV,
    FFMEDIA_CODEC_SCREENPRESSO,
    FFMEDIA_CODEC_RSCC,

    FFMEDIA_CODEC_Y41P = 0x8000,
    FFMEDIA_CODEC_AVRP,
    FFMEDIA_CODEC_012V,
    FFMEDIA_CODEC_AVUI,
    FFMEDIA_CODEC_AYUV,
    FFMEDIA_CODEC_TARGA_Y216,
    FFMEDIA_CODEC_V308,
    FFMEDIA_CODEC_V408,
    FFMEDIA_CODEC_YUV4,
    FFMEDIA_CODEC_AVRN,
    FFMEDIA_CODEC_CPIA,
    FFMEDIA_CODEC_XFACE,
    FFMEDIA_CODEC_SNOW,
    FFMEDIA_CODEC_SMVJPEG,
    FFMEDIA_CODEC_APNG,
    FFMEDIA_CODEC_DAALA,
    FFMEDIA_CODEC_CFHD,
    FFMEDIA_CODEC_TRUEMOTION2RT,
    FFMEDIA_CODEC_M101,
    FFMEDIA_CODEC_MAGICYUV,
    FFMEDIA_CODEC_SHEERVIDEO,
    FFMEDIA_CODEC_YLC,
    FFMEDIA_CODEC_PSD,
    FFMEDIA_CODEC_PIXLET,
    FFMEDIA_CODEC_SPEEDHQ,
    FFMEDIA_CODEC_FMVC,
    FFMEDIA_CODEC_SCPR,
    FFMEDIA_CODEC_CLEARVIDEO,
    FFMEDIA_CODEC_XPM,
    FFMEDIA_CODEC_AV1,
    FFMEDIA_CODEC_BITPACKED,
    FFMEDIA_CODEC_MSCC,
    FFMEDIA_CODEC_SRGC,
    FFMEDIA_CODEC_SVG,
    FFMEDIA_CODEC_GDV,
    FFMEDIA_CODEC_FITS,

    /* various PCM "codecs" */
    FFMEDIA_CODEC_FIRST_AUDIO = 0x10000,     ///< A dummy id pointing at the start of audio codecs
    FFMEDIA_CODEC_PCM_S16LE = 0x10000,
    FFMEDIA_CODEC_PCM_S16BE,
    FFMEDIA_CODEC_PCM_U16LE,
    FFMEDIA_CODEC_PCM_U16BE,
    FFMEDIA_CODEC_PCM_S8,
    FFMEDIA_CODEC_PCM_U8,
    FFMEDIA_CODEC_PCM_MULAW,
    FFMEDIA_CODEC_PCM_ALAW,
    FFMEDIA_CODEC_PCM_S32LE,
    FFMEDIA_CODEC_PCM_S32BE,
    FFMEDIA_CODEC_PCM_U32LE,
    FFMEDIA_CODEC_PCM_U32BE,
    FFMEDIA_CODEC_PCM_S24LE,
    FFMEDIA_CODEC_PCM_S24BE,
    FFMEDIA_CODEC_PCM_U24LE,
    FFMEDIA_CODEC_PCM_U24BE,
    FFMEDIA_CODEC_PCM_S24DAUD,
    FFMEDIA_CODEC_PCM_ZORK,
    FFMEDIA_CODEC_PCM_S16LE_PLANAR,
    FFMEDIA_CODEC_PCM_DVD,
    FFMEDIA_CODEC_PCM_F32BE,
    FFMEDIA_CODEC_PCM_F32LE,
    FFMEDIA_CODEC_PCM_F64BE,
    FFMEDIA_CODEC_PCM_F64LE,
    FFMEDIA_CODEC_PCM_BLURAY,
    FFMEDIA_CODEC_PCM_LXF,
    FFMEDIA_CODEC_S302M,
    FFMEDIA_CODEC_PCM_S8_PLANAR,
    FFMEDIA_CODEC_PCM_S24LE_PLANAR,
    FFMEDIA_CODEC_PCM_S32LE_PLANAR,
    FFMEDIA_CODEC_PCM_S16BE_PLANAR,

    FFMEDIA_CODEC_PCM_S64LE = 0x10800,
    FFMEDIA_CODEC_PCM_S64BE,
    FFMEDIA_CODEC_PCM_F16LE,
    FFMEDIA_CODEC_PCM_F24LE,

    /* various ADPCM codecs */
    FFMEDIA_CODEC_ADPCM_IMA_QT = 0x11000,
    FFMEDIA_CODEC_ADPCM_IMA_WAV,
    FFMEDIA_CODEC_ADPCM_IMA_DK3,
    FFMEDIA_CODEC_ADPCM_IMA_DK4,
    FFMEDIA_CODEC_ADPCM_IMA_WS,
    FFMEDIA_CODEC_ADPCM_IMA_SMJPEG,
    FFMEDIA_CODEC_ADPCM_MS,
    FFMEDIA_CODEC_ADPCM_4XM,
    FFMEDIA_CODEC_ADPCM_XA,
    FFMEDIA_CODEC_ADPCM_ADX,
    FFMEDIA_CODEC_ADPCM_EA,
    FFMEDIA_CODEC_ADPCM_G726,
    FFMEDIA_CODEC_ADPCM_CT,
    FFMEDIA_CODEC_ADPCM_SWF,
    FFMEDIA_CODEC_ADPCM_YAMAHA,
    FFMEDIA_CODEC_ADPCM_SBPRO_4,
    FFMEDIA_CODEC_ADPCM_SBPRO_3,
    FFMEDIA_CODEC_ADPCM_SBPRO_2,
    FFMEDIA_CODEC_ADPCM_THP,
    FFMEDIA_CODEC_ADPCM_IMA_AMV,
    FFMEDIA_CODEC_ADPCM_EA_R1,
    FFMEDIA_CODEC_ADPCM_EA_R3,
    FFMEDIA_CODEC_ADPCM_EA_R2,
    FFMEDIA_CODEC_ADPCM_IMA_EA_SEAD,
    FFMEDIA_CODEC_ADPCM_IMA_EA_EACS,
    FFMEDIA_CODEC_ADPCM_EA_XAS,
    FFMEDIA_CODEC_ADPCM_EA_MAXIS_XA,
    FFMEDIA_CODEC_ADPCM_IMA_ISS,
    FFMEDIA_CODEC_ADPCM_G722,
    FFMEDIA_CODEC_ADPCM_IMA_APC,
    FFMEDIA_CODEC_ADPCM_VIMA,

    FFMEDIA_CODEC_ADPCM_AFC = 0x11800,
    FFMEDIA_CODEC_ADPCM_IMA_OKI,
    FFMEDIA_CODEC_ADPCM_DTK,
    FFMEDIA_CODEC_ADPCM_IMA_RAD,
    FFMEDIA_CODEC_ADPCM_G726LE,
    FFMEDIA_CODEC_ADPCM_THP_LE,
    FFMEDIA_CODEC_ADPCM_PSX,
    FFMEDIA_CODEC_ADPCM_AICA,
    FFMEDIA_CODEC_ADPCM_IMA_DAT4,
    FFMEDIA_CODEC_ADPCM_MTAF,

    /* AMR */
    FFMEDIA_CODEC_AMR_NB = 0x12000,
    FFMEDIA_CODEC_AMR_WB,

    /* RealAudio codecs*/
    FFMEDIA_CODEC_RA_144 = 0x13000,
    FFMEDIA_CODEC_RA_288,

    /* various DPCM codecs */
    FFMEDIA_CODEC_ROQ_DPCM = 0x14000,
    FFMEDIA_CODEC_INTERPLAY_DPCM,
    FFMEDIA_CODEC_XAN_DPCM,
    FFMEDIA_CODEC_SOL_DPCM,

    FFMEDIA_CODEC_SDX2_DPCM = 0x14800,
    FFMEDIA_CODEC_GREMLIN_DPCM,

    /* audio codecs */
    FFMEDIA_CODEC_MP2 = 0x15000,
    FFMEDIA_CODEC_MP3, ///< preferred ID for decoding MPEG audio layer 1, 2 or 3
    FFMEDIA_CODEC_AAC,
    FFMEDIA_CODEC_AC3,
    FFMEDIA_CODEC_DTS,
    FFMEDIA_CODEC_VORBIS,
    FFMEDIA_CODEC_DVAUDIO,
    FFMEDIA_CODEC_WMAV1,
    FFMEDIA_CODEC_WMAV2,
    FFMEDIA_CODEC_MACE3,
    FFMEDIA_CODEC_MACE6,
    FFMEDIA_CODEC_VMDAUDIO,
    FFMEDIA_CODEC_FLAC,
    FFMEDIA_CODEC_MP3ADU,
    FFMEDIA_CODEC_MP3ON4,
    FFMEDIA_CODEC_SHORTEN,
    FFMEDIA_CODEC_ALAC,
    FFMEDIA_CODEC_WESTWOOD_SND1,
    FFMEDIA_CODEC_GSM, ///< as in Berlin toast format
    FFMEDIA_CODEC_QDM2,
    FFMEDIA_CODEC_COOK,
    FFMEDIA_CODEC_TRUESPEECH,
    FFMEDIA_CODEC_TTA,
    FFMEDIA_CODEC_SMACKAUDIO,
    FFMEDIA_CODEC_QCELP,
    FFMEDIA_CODEC_WAVPACK,
    FFMEDIA_CODEC_DSICINAUDIO,
    FFMEDIA_CODEC_IMC,
    FFMEDIA_CODEC_MUSEPACK7,
    FFMEDIA_CODEC_MLP,
    FFMEDIA_CODEC_GSM_MS, /* as found in WAV */
    FFMEDIA_CODEC_ATRAC3,
    FFMEDIA_CODEC_APE,
    FFMEDIA_CODEC_NELLYMOSER,
    FFMEDIA_CODEC_MUSEPACK8,
    FFMEDIA_CODEC_SPEEX,
    FFMEDIA_CODEC_WMAVOICE,
    FFMEDIA_CODEC_WMAPRO,
    FFMEDIA_CODEC_WMALOSSLESS,
    FFMEDIA_CODEC_ATRAC3P,
    FFMEDIA_CODEC_EAC3,
    FFMEDIA_CODEC_SIPR,
    FFMEDIA_CODEC_MP1,
    FFMEDIA_CODEC_TWINVQ,
    FFMEDIA_CODEC_TRUEHD,
    FFMEDIA_CODEC_MP4ALS,
    FFMEDIA_CODEC_ATRAC1,
    FFMEDIA_CODEC_BINKAUDIO_RDFT,
    FFMEDIA_CODEC_BINKAUDIO_DCT,
    FFMEDIA_CODEC_AAC_LATM,
    FFMEDIA_CODEC_QDMC,
    FFMEDIA_CODEC_CELT,
    FFMEDIA_CODEC_G723_1,
    FFMEDIA_CODEC_G729,
    FFMEDIA_CODEC_8SVX_EXP,
    FFMEDIA_CODEC_8SVX_FIB,
    FFMEDIA_CODEC_BMV_AUDIO,
    FFMEDIA_CODEC_RALF,
    FFMEDIA_CODEC_IAC,
    FFMEDIA_CODEC_ILBC,
    FFMEDIA_CODEC_OPUS,
    FFMEDIA_CODEC_COMFORT_NOISE,
    FFMEDIA_CODEC_TAK,
    FFMEDIA_CODEC_METASOUND,
    FFMEDIA_CODEC_PAF_AUDIO,
    FFMEDIA_CODEC_ON2AVC,
    FFMEDIA_CODEC_DSS_SP,
    FFMEDIA_CODEC_CODEC2,

    FFMEDIA_CODEC_FFWAVESYNTH = 0x15800,
    FFMEDIA_CODEC_SONIC,
    FFMEDIA_CODEC_SONIC_LS,
    FFMEDIA_CODEC_EVRC,
    FFMEDIA_CODEC_SMV,
    FFMEDIA_CODEC_DSD_LSBF,
    FFMEDIA_CODEC_DSD_MSBF,
    FFMEDIA_CODEC_DSD_LSBF_PLANAR,
    FFMEDIA_CODEC_DSD_MSBF_PLANAR,
    FFMEDIA_CODEC_4GV,
    FFMEDIA_CODEC_INTERPLAY_ACM,
    FFMEDIA_CODEC_XMA1,
    FFMEDIA_CODEC_XMA2,
    FFMEDIA_CODEC_DST,
    FFMEDIA_CODEC_ATRAC3AL,
    FFMEDIA_CODEC_ATRAC3PAL,
    FFMEDIA_CODEC_DOLBY_E,
    FFMEDIA_CODEC_APTX,
    FFMEDIA_CODEC_APTX_HD,
    FFMEDIA_CODEC_SBC,

    /* subtitle codecs */
    FFMEDIA_CODEC_FIRST_SUBTITLE = 0x17000,          ///< A dummy ID pointing at the start of subtitle codecs.
    FFMEDIA_CODEC_DVD_SUBTITLE = 0x17000,
    FFMEDIA_CODEC_DVB_SUBTITLE,
    FFMEDIA_CODEC_TEXT,  ///< raw UTF-8 text
    FFMEDIA_CODEC_XSUB,
    FFMEDIA_CODEC_SSA,
    FFMEDIA_CODEC_MOV_TEXT,
    FFMEDIA_CODEC_HDMV_PGS_SUBTITLE,
    FFMEDIA_CODEC_DVB_TELETEXT,
    FFMEDIA_CODEC_SRT,

    FFMEDIA_CODEC_MICRODVD = 0x17800,
    FFMEDIA_CODEC_EIA_608,
    FFMEDIA_CODEC_JACOSUB,
    FFMEDIA_CODEC_SAMI,
    FFMEDIA_CODEC_REALTEXT,
    FFMEDIA_CODEC_STL,
    FFMEDIA_CODEC_SUBVIEWER1,
    FFMEDIA_CODEC_SUBVIEWER,
    FFMEDIA_CODEC_SUBRIP,
    FFMEDIA_CODEC_WEBVTT,
    FFMEDIA_CODEC_MPL2,
    FFMEDIA_CODEC_VPLAYER,
    FFMEDIA_CODEC_PJS,
    FFMEDIA_CODEC_ASS,
    FFMEDIA_CODEC_HDMV_TEXT_SUBTITLE,

    /* other specific kind of codecs (generally used for attachments) */
    FFMEDIA_CODEC_FIRST_UNKNOWN = 0x18000,           ///< A dummy ID pointing at the start of various fake codecs.
    FFMEDIA_CODEC_TTF = 0x18000,

    FFMEDIA_CODEC_SCTE_35, ///< Contain timestamp estimated through PCR of program stream.
    FFMEDIA_CODEC_BINTEXT = 0x18800,
    FFMEDIA_CODEC_XBIN,
    FFMEDIA_CODEC_IDF,
    FFMEDIA_CODEC_OTF,
    FFMEDIA_CODEC_SMPTE_KLV,
    FFMEDIA_CODEC_DVD_NAV,
    FFMEDIA_CODEC_TIMED_ID3,
    FFMEDIA_CODEC_BIN_DATA,


    FFMEDIA_CODEC_PROBE = 0x19000, ///< codec_id is not known (like FFMEDIA_CODEC_NONE) but lavf should attempt to identify it

    FFMEDIA_CODEC_MPEG2TS = 0x20000, /**< _FAKE_ codec to indicate a raw MPEG-2 TS
    * stream (only used by libavformat) */
    FFMEDIA_CODEC_MPEG4SYSTEMS = 0x20001, /**< _FAKE_ codec to indicate a MPEG-4 Systems
    * stream (only used by libavformat) */
    FFMEDIA_CODEC_FFMETADATA = 0x21000,   ///< Dummy codec for streams containing only metadata information.
    FFMEDIA_CODEC_ID_WRAPPED_AVFRAME = 0x21001, ///< Passthrough codec, AVFrames wrapped in AVPacket

};


/**
 * 媒体格式.
 */
typedef struct FfMediaFormat
{
	int duration;         // 文件时长. 单位毫秒.

	int	codec;		/// 视频编码(或者混合编码).
	int width;
	int height;
	double framerate;
	int bitrate;
	int profile;			/// video codec profile
	int level;
	int gop;

	int audioCodec;	/// 音频编码.
	int	channels;	/// 通道数.
	int samplerate;	/// 采样率.
	int audioProfile;		/// audio codec profile

	int frameSize;
	int audioBitrate;


	int bframe;
	char fmtName[56];

	uint8_t* prop;
	int propSize;

	int configSize;      ///音频描述信息长度，即audioProp实际长度.
	uint8_t* config;     ///音频描述信息.

    int videoDuration;   /// 视频时长, 单位毫秒.


} FfMediaFormat;


/////////////////////////////////////////////////////////////////////////////

/**
 * 获取媒体信息
 * @param filepath	文件路径
 * @param fmt		媒体信息
 * @param frameCount	帧数, 可以为空.
 * @return 0 如果成功, 其他表示错误码
 */
extern "C" DLLEXPORT int ff_getMediaInfo(const char* filepath, FfMediaFormat* fmt, int* frameCount);

/**
 * 获取文件帧率
 * @param filepath	文件路径
 * @param framerate	帧率
 * @return 0 如果成功, 其他表示错误码
 */
extern "C" DLLEXPORT int ff_getFrameRate(const char* filepath, double* framerate);

/**
 * 获取视频帧信息
 * @param filepath	文件路径
 * @param framerate	帧率
 * @param duration	时长, 单位为毫秒
 * @param frameCount	帧总数
 * @return
 */
extern "C" DLLEXPORT int ff_getVideoFrameInfo(const char* filepath, double* framerate, int* duration, int* frameCount);




/////////////////////////////////////////////////////////////////////////////

#ifdef __cplusplus
}
#endif



#endif /* INCLUDE_FFMEDIAINFO_H_ */
